package star.cloud.asme.base.fowable.listener.taskListener;

import lombok.RequiredArgsConstructor;
import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;
import org.springframework.stereotype.Component;
import star.cloud.asme.system.department.Department;
import star.cloud.asme.system.department.DepartmentService;

@Component("departmentManagerUserTaskListener")
@RequiredArgsConstructor
public class DepartmentManagerTaskListener implements TaskListener {
    private final DepartmentService departmentService;

    @Override
    public void notify(DelegateTask delegateTask) {
        Long departmentId = (Long) delegateTask.getVariable("department");
        Department department = departmentService.getById(departmentId);
        delegateTask.setAssignee("dujuanjuan");
    }
}
